import Vant from 'vant';
import 'vant/lib/index.css';
import '../assets/base.scss';
import '../assets/rem-vant.scss';
import {App} from 'vue';
import {Notify, Toast} from 'vant';

/**
 * 注册ui视图
 * @param app 应用实例对象
 */
export const setUi = (app: App) => {
    app.use(Vant).use(Notify).use(Toast)
};

/**
 * 尺寸适配
 */
function setRem() {
    const dom = (document.documentElement || document.body);
    const scale = (dom.clientWidth > 750 ? 450 : dom.clientWidth) / 750;
    dom.style.fontSize = (75 * Math.min(scale, 2)) + 'px';
}

setRem();
// 屏幕改变触发
window.onresize = setRem;